<?php /* Smarty version 2.6.25, created on 2013-11-15 11:18:23
         compiled from book/views/admin.new-chapter.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'count', 'book/views/admin.new-chapter.tpl', 210, false),)), $this); ?>
	<script type="text/javascript" src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/ckeditor/ckeditor.js"></script> 
	<script type="text/javascript" src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/ckfinder/ckfinder.js"></script>  
	<link href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery-ui/css/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/>
	<script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery-ui/js/jquery-ui.js"></script>
	<script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery.slug.js"></script>
	<!-- Bootstrap -->
	
	<script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery.tmpl.min.js"></script>
	
	<script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/bootstrap.file-input.js"></script>
	<script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/init.js"></script>
	
	<link href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/css/bootstrap.css" rel="stylesheet" media="screen">
	<link href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/css/style2.css" rel="stylesheet" />
	<!--                       CSS                       -->
	
	<link rel="stylesheet" href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/css/reset.css"  type="text/css"  />
	
	<link rel="stylesheet" href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/css/style.css" type="text/css" />
	
	<link rel="stylesheet" href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/css/invalid.css"  type="text/css" /> 
	<!-- <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> -->
	<script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery-1.9.1.js"></script>
	<script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery-ui.js"></script>
	
	
	<link rel="stylesheet" type="text/css" href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/css/jquery.multiselect.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/css/jquery.multiselect.filter.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/css/multiSelect.css" />
	
	<!-- <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/jquery-ui.css" /> -->
	
	<script type="text/javascript" src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery.multiselect.js"></script>
	<script type="text/javascript" src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery.multiselect.filter.js"></script>
	
	<style>
	    .ui-autocomplete {
	        max-height: 200px;
	        overflow-y: auto;
	        /* prevent horizontal scrollbar */
	        overflow-x: hidden;
	        /* add padding to account for vertical scrollbar */
	        padding-right: 20px;
	    }
	    /* IE 6 doesn't support max-height
	     * we use height instead, but this forces the menu to always be this tall
	    */
	    * html .ui-autocomplete {
	        height: 100px;
	        width:450px;
	    }
	</style>
	<style>
	    .custom-combobox {
	        position: relative;
	        display: inline-block;
	    }
	    .custom-combobox-toggle {
	        position: absolute;
	        top: 0;
	        bottom: 0;
	        margin-left: -1px;
	        padding: 0;
	        /* support: IE7 */
	        *height: 1.7em;
	        *top: 0.1em;
	    }
	    .custom-combobox-input {
	        margin: 0;
	        padding: 0.3em;
	    }
	</style>
	<script>
	
	</script>
	
	<script type="text/javascript">
	    var allChaps = [];
	    // unchange
	    var htmlList = "<optgroup label='sort'>";
						
	    <?php $_from = $this->_tpl_vars['allCats']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
						
	
	
	        htmlList = htmlList + '<option  value="' + "<?php echo $this->_tpl_vars['item']['question_gid']; ?>
" + '" >' + "<?php echo $this->_tpl_vars['item']['title']; ?>
" + '</option>';
	    <?php endforeach; endif; unset($_from); ?>
	        htmlList = htmlList + '</optgroup>'
	            + "<optgroup label='list'>";
	    <?php $_from = $this->_tpl_vars['allCats']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
	        htmlList = htmlList + '<option  value="' + "<?php echo $this->_tpl_vars['item']['question_gid']; ?>
" + '" >' + "<?php echo $this->_tpl_vars['item']['title']; ?>
" + '</option>';
	    <?php endforeach; endif; unset($_from); ?>
	        htmlList = htmlList + '</optgroup>';
						
			
						
	        // tam
	        function split( val ) {
	        return val.split( /,\s*/ );
	    }
	    function extractLast( term ) {
	    return split( term ).pop();
	}					
	function showMenu() {
		$("#unit").autocomplete( "search" , '' );
	}
	function submitBook()
	{
	
		$('input.chapter_titles').val(allChaps);
		$('#submitFormQuestion').submit();
		
	}
	
	
	jQuery(document).ready(function (){ 
	 
	 
		
	$( "#accordion" ).accordion({header: "> div > h3"}).sortable({
		axis: "y",
		handle: "h3",
		stop: function( event, ui ) {
		// IE doesn't register the blur when sorting
		// so trigger focusout handlers to remove .ui-state-focus
		ui.item.children( "h3" ).triggerHandler( "focusout" );
		}
	});  	 
	var availableUnit = new Array();
	  	       
	    <?php $_from = $this->_tpl_vars['allChapters']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['item']):
?>
			availableUnit[<?php echo $this->_tpl_vars['k']; ?>
] = "<?php echo $this->_tpl_vars['item']['name']; ?>
";
	    <?php endforeach; endif; unset($_from); ?>                 
	$( "#unit" )
	.bind( "keydown", function( event ) {
		if ( event.keyCode === $.ui.keyCode.TAB &&
		$( this ).data( "autocomplete" ).menu.active ) {
		event.preventDefault();
		}
	})
	.autocomplete({
		minLength: 0,
		source: function( request, response ) {
		// delegate back to autocomplete, but extract the last term
		response( $.ui.autocomplete.filter(
		availableUnit, extractLast( request.term ) ) );
	},
	focus: function() {
	// prevent value inserted on focus
		return false;
		},
	 	                
	});   
	
	  	       
	
	$("select.multi").multiselect().multiselectfilter(); 	    	
	        
});
	    
	function addChap()
	{
		var chap = $('input#unit').val();
		var html = "<p>"+ chap + "</p>";
		allChaps.push(chap);
		var t = $('select[name=data_question]').html();
			
		var newPanel='<div class="group"><h3><b>'+chap + '</b></h3><div >' + '<p><label>Question</label><select name="data['+ chap + '][]" multiple="multiple" style="width:370px">'	
					+ t +'</select><div class="full_text" style="margin-left:595px;"></div></p></div>';
					
						
		$('#accordion').append(newPanel).accordion('destroy').accordion({header: "> div > h3"}).sortable({
			axis: "y",
			handle: "h3",
			stop: function( event, ui ) {
			// IE doesn't register the blur when sorting
			// so trigger focusout handlers to remove .ui-state-focus
			ui.item.children( "h3" ).triggerHandler( "focusout" );
			}
		});
																	
																	
		$("select").multiselect().multiselectfilter();
			
	
	}  
	</script>
	
	
	
	
	<div class="content-box"><!-- Start Content Box -->
	
	    <div class="content-box-header">
	
	        <h3>Create Chapter</h3>
	
	        <div class="clear"></div>
	
	    </div> <!-- End .content-box-header -->
	
	    <div class="content-box-content">
	
	        <form action="" method="post" id="submitFormQuestion">
	
	            <!-- GENERAL -->
	            <div class="tab-content id="tab0">
	
	                 <!-- ERROR -->
	                 <?php if (count($this->_tpl_vars['errors']) > 0): ?>
	                 <div class="notification error png_bg">
	                    <a href="#" class="close"><img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
	                    <div>
	                        <?php if ($this->_tpl_vars['errors']['main']): ?>
	                        Error: <?php echo $this->_tpl_vars['errors']['main']; ?>

	                        <?php else: ?>
	                        Error: Please check following information again
	                        <?php endif; ?> 
	
	                    </div>
	                </div>
	                <?php endif; ?>
	
	
	                <?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['langDiv'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['langDiv']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['item']):
        $this->_foreach['langDiv']['iteration']++;
?>
	                <p>
	                    <label>Title</label>
	                    <image style="vertical-align:middle;" src="<?php echo $this->_tpl_vars['BASE_URL']; ?>
<?php echo $this->_tpl_vars['item']['lang_image']; ?>
"> <?php echo $this->_tpl_vars['item']['name']; ?>
 
	                    <br> 
	                    <input id="title" class="text-input small-input" type="text" style="width:364px;" name="data[<?php echo $this->_tpl_vars['item']['lang_id']; ?>
][name]" value="<?php echo $this->_tpl_vars['data'][$this->_tpl_vars['item']['lang_id']]['name']; ?>
" />
	                </p>
	                <?php endforeach; endif; unset($_from); ?>				
	
	
	            </div>
	
	            <div>
	                <p>
	                    <label>Category<span class="red">*</span></label>              
	                    <select name="data[subject_id]" class="small-input" style="width:380px">
	                        <?php $_from = $this->_tpl_vars['allSubjects']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
	                        <option value="<?php echo $this->_tpl_vars['item']['content_category_gid']; ?>
" <?php if ($this->_tpl_vars['data']['subject_id'] == $this->_tpl_vars['item']['content_category_gid']): ?>selected="selected"<?php endif; ?>><?php echo $this->_tpl_vars['item']['name']; ?>
</option>
	                        <?php endforeach; endif; unset($_from); ?>
	                    </select> 
	                </p>
	
	                <p><label>Lecture</label>
	                    <select name="data[lecture_ids][]"  class="multi" multiple="multiple" style="width:380px">	
	                        <?php $_from = $this->_tpl_vars['allCatLecture']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>	
	                        <optgroup label="<?php echo $this->_tpl_vars['item']['group']; ?>
">
	
	                            <?php $_from = $this->_tpl_vars['item']['lectures']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item2']):
?>	
	                            <option value="<?php echo $this->_tpl_vars['item2']['content_gid']; ?>
"  ><?php echo $this->_tpl_vars['item2']['title']; ?>
</option>
	                            <?php endforeach; endif; unset($_from); ?>
	                        </optgroup>
	                        <?php endforeach; endif; unset($_from); ?>
	
	                    </select>
	
	            </div>
	
	            <div>
	                <p><label>Question</label>
	                    <select name="data[question_ids][]" class="multi" multiple="multiple" style="width:380px">	
	                        <?php $_from = $this->_tpl_vars['allCats']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>	
	                        <optgroup label="<?php echo $this->_tpl_vars['item']['group']; ?>
">
	
	                            <?php $_from = $this->_tpl_vars['item']['questions']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item2']):
?>	
	                            <option value="<?php echo $this->_tpl_vars['item2']['question_gid']; ?>
"  ><?php echo $this->_tpl_vars['item2']['full_text']; ?>
</option>
	                            <?php endforeach; endif; unset($_from); ?>
	                        </optgroup>
	                        <?php endforeach; endif; unset($_from); ?>
	
	                    </select>
	                </p>
	            </div>
	            <div>
	                <p><label>Demo</label>
	                    <select name="data[folder_ids][]" class="multi" multiple="multiple" style="width:380px">	
	                        <?php $_from = $this->_tpl_vars['allDemoCat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>	
	                        <optgroup label="<?php echo $this->_tpl_vars['item']['group']; ?>
">
	
	                            <?php $_from = $this->_tpl_vars['item']['folders']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item2']):
?>	
	                            <option value="<?php echo $this->_tpl_vars['item2']['folder_id']; ?>
"  ><?php echo $this->_tpl_vars['item2']['title']; ?>
</option>
	                            <?php endforeach; endif; unset($_from); ?>
	                        </optgroup>
	                        <?php endforeach; endif; unset($_from); ?>
	
	                    </select>
	                </p>
	            </div>
	            <div>
	                <p><label>Exercise</label>
	                    <select name="data[exercise_ids][]" class="multi" multiple="multiple" style="width:380px">	
	                        <?php $_from = $this->_tpl_vars['allExerciseCat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>	
	                        <optgroup label="<?php echo $this->_tpl_vars['item']['group']; ?>
">
	
	                            <?php $_from = $this->_tpl_vars['item']['exercises']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item2']):
?>	
	                            <option value="<?php echo $this->_tpl_vars['item2']['exercise_parameter_gid']; ?>
"  ><?php echo $this->_tpl_vars['item2']['title']; ?>
</option>
	                            <?php endforeach; endif; unset($_from); ?>
	                        </optgroup>
	                        <?php endforeach; endif; unset($_from); ?>
	
	                    </select>
	                </p>
	            </div>
	            </br>
	
	
	
	            <p>
	                <br/>
	                <input class="button" onclick="submitBook()" type="button" value="Save" />
	            </p>
	            <div class="clear"></div><!-- End .clear -->
	
	    </div>  <!-- End GENERAL --> 
	</form>
	
	</div> <!-- End .content-box-content -->
	
	</div> <!-- End .content-box -->
	
	
	